//
//  TKIMHttpRequestHelper.h
//  TKIM
//
//  Created by macpro on 15/12/2.
//  Copyright © 2015年 liupm. All rights reserved.
//
#import <UIKit/UIKit.h>

@class TKIMHttpRequestHelper;

//请求成功的回调
typedef void(^HttpRequestDidFinishBlock)(TKIMHttpRequestHelper *request);
//请求失败的回调
typedef void(^HttpRequestDidErrorBlock)(NSError *error);
//进度的回调
typedef void(^HttpRequestReceiveProgessBlock)(CGFloat progess);

@interface TKIMHttpRequestHelper : NSObject

/**
 *  请求的数据
 */
@property (nonatomic, strong) NSData *responseData;
@property (nonatomic, copy) NSString *responseString;

/**
 *  构造方法
 *  @param url 要请求的远程地址
 */
- (instancetype)initWithUrl:(NSURL *)url;

/**
 *  请求数据（发送异步请求）
 */
- (void)startHttpRequest;

/**
 *  设置成功和失败的回调
 */
- (void)setHttpRequestDidFininshBlock:(HttpRequestDidFinishBlock)finishBlock requestDidErrorBlock:(HttpRequestDidErrorBlock)errorBlock;

/**
 *  设置进度回调
 */
- (void)setHttpRequestReceiveProgessBlock:(HttpRequestReceiveProgessBlock)progessBlock;

@end
